﻿using System;
using System.Text;

namespace ITTestingSystem.BusinessLogic.TokenService
{
    public class UserTokenService : IUserTokenService
    {
        string IUserTokenService.GetToken(string key)
        {
            var keyBytes = Encoding.UTF8.GetBytes(key);

            var token = Convert.ToBase64String(keyBytes);

            return token;
        }

        string IUserTokenService.GetKeyFromToken(string token)
        {
            var tokenBytes = Convert.FromBase64String(token);

            var key = Encoding.UTF8.GetString(tokenBytes);

            return key;
        }
    }
}